]> dgit.raspbian.org Git - ostree.git/commit
checkout: Fix GVariant leak when scanning for opaque whiteouts
authorJonas Svatos <jonas.svatos@nfa.cz>
Thu, 11 Jun 2026 08:02:44 +0000 (10:02 +0200)
committerJonas Svatos <jonas.svatos@nfa.cz>
Thu, 11 Jun 2026 08:02:44 +0000 (10:02 +0200)
commit04fb288f77545e87218930f4990c71bb42af5687
tree7a52873b5005ddbaa18c1561bf2dd62f8a64e179
parent1d2b902b5513287355ad3322cb4027b67bb71b88
checkout: Fix GVariant leak when scanning for opaque whiteouts

Breaking out of g_variant_iter_loop() leaves ownership of the current
element with the caller. The opaque-whiteout scan in
checkout_tree_at_recurse() breaks out of the loop when it finds a
match, and then cleared the local pointer, leaking one reference to
the extracted checksum variant on every directory that contains an
opaque whiteout entry.

A leaked child variant keeps the whole backing dirtree object alive,
including its GMappedFile when the object was large enough to be
mmap'd rather than read into the heap. In a process that unmounts the
target filesystem afterwards - notably `bootc install to-disk`, which
checks out container layers with process_whiteouts enabled and then
unmounts the physical root - the stale mapping makes the final
`umount -R` fail with EBUSY, aborting the installation.

Since the scan only needs the entry name, pass NULL to skip extracting
the checksum entirely, so nothing needs freeing on the early exit.

Fixes: https://github.com/bootc-dev/bootc/issues/2246
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Jonas Svatos <jonas.svatos@nfa.cz>
src/libostree/ostree-repo-checkout.c